package com.ruoyi.web.controller.fan;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.control.domain.MainventilatorOne;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.control.domain.MainventilatorTwo;
import com.ruoyi.control.service.IMainventilatorTwoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 主通风机2号风机Controller
 * 
 * @author ruoyi
 * @date 2024-11-08
 */
@RestController
@RequestMapping("/control/mainventilatorTwo")
public class MainventilatorTwoController extends BaseController
{
    @Autowired
    private IMainventilatorTwoService mainventilatorTwoService;

    /**
     * 查询主通风机2号风机列表
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:list')")
    @GetMapping("/list")
    public TableDataInfo list(MainventilatorTwo mainventilatorTwo)
    {
        startPage();
        List<MainventilatorTwo> list = mainventilatorTwoService.selectMainventilatorTwoList(mainventilatorTwo);
        return getDataTable(list);
    }
    @PreAuthorize("@ss.hasPermi('control:mainventilatorOne:list')")
    @GetMapping("/getDF")
    public List<MainventilatorTwo> getDF()
    {
        List<MainventilatorTwo> list = mainventilatorTwoService.getDF();
        return list;
    }
    /**
     * 查询主通风机2号风机列表
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:list')")
    @GetMapping("/getList")
    public List<MainventilatorTwo> getList()
    {
        List<MainventilatorTwo> list = mainventilatorTwoService.getList();
        return list;
    }
    /**
     * 导出主通风机2号风机列表
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:export')")
    @Log(title = "主通风机2号风机", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MainventilatorTwo mainventilatorTwo)
    {
        List<MainventilatorTwo> list = mainventilatorTwoService.selectMainventilatorTwoList(mainventilatorTwo);
        ExcelUtil<MainventilatorTwo> util = new ExcelUtil<MainventilatorTwo>(MainventilatorTwo.class);
        util.exportExcel(response, list, "主通风机2号风机数据");
    }

    /**
     * 获取主通风机2号风机详细信息
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:query')")
    @GetMapping(value = "/{address}")
    public AjaxResult getInfo(@PathVariable("address") String address)
    {
        return success(mainventilatorTwoService.selectMainventilatorTwoByAddress(address));
    }

    /**
     * 新增主通风机2号风机
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:add')")
    @Log(title = "主通风机2号风机", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MainventilatorTwo mainventilatorTwo)
    {
        return toAjax(mainventilatorTwoService.insertMainventilatorTwo(mainventilatorTwo));
    }

    /**
     * 修改主通风机2号风机
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:edit')")
    @Log(title = "主通风机2号风机", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MainventilatorTwo mainventilatorTwo)
    {
        return toAjax(mainventilatorTwoService.updateMainventilatorTwo(mainventilatorTwo));
    }

    /**
     * 删除主通风机2号风机
     */
    @PreAuthorize("@ss.hasPermi('control:mainventilatorTwo:remove')")
    @Log(title = "主通风机2号风机", businessType = BusinessType.DELETE)
	@DeleteMapping("/{addresss}")
    public AjaxResult remove(@PathVariable String[] addresss)
    {
        return toAjax(mainventilatorTwoService.deleteMainventilatorTwoByAddresss(addresss));
    }
}
